<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
	<canvas id="canvas" width="500" height="500" style="border:1px solid #ccc"></canvas>

</body>
</html>

<script type="text/javascript">

	var canvas = document.getElementById('canvas');
	var context = canvas.getContext('2d');
	//下面是画矩形框//
	context.strokeRect(25,25,100,50);
	//下面是放大或缩小矩形//
	context.scale(2,2);
	context.strokeStyle = 'red';
	context.strokeRect(25,25,100,50)
	//坐标也会跟着放大或缩小//

</script>